<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8" session="false" %>
<%@ page import="com.atozsoft.commonutil.Constants"%>
<%@ page import="java.util.Date"%>
<%@ page import="java.text.SimpleDateFormat"%>
	
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<!-- 
  - Author(s): houfy
  - Date: 2014-11-13 14:22:31
  - Description:
-->
<head>
    <%@include file="/common.jsp"%>
	<%@include file="/common/common.jsp"%>
    <%@include file="/coframe/tools/skins/common.jsp"%>
	<title>流程明细</title>
	<style type="text/css">
	    html, body{
	        margin:0;padding:0;width:100%;height:100%;
	    }    
    </style>
    <style type="text/css">
	    .asLabel .mini-textbox-border,
	    .asLabel .mini-textbox-input,
	    .asLabel .mini-buttonedit-border,
	    .asLabel .mini-buttonedit-input,
	    .asLabel .mini-textboxlist-border
	    {
	        border:0;background:none;cursor:default;
	    }
	    .asLabel .mini-buttonedit-button,
	    .asLabel .mini-textboxlist-close
	    {
	        display:none;
	    }
	    .asLabel .mini-textboxlist-item
	    {
	        padding-right:8px;
	    }    
    </style>
	<%
 	 	String processDefID = request.getParameter("processDefID");
 	%>
</head>
<body scrolling="no">
	<div class="nui-fit">
		<div id="panel1" class="nui-panel" title="流程基本信息" iconCls="icon-collapse" style="width:100%;height:130px;" expanded="true" showCollapseButton="true" collapseOnTitleClick="true">
		  <div id="processInfoForm">
			  <table class="table" style="width:100%; border-spacing:0px; border-collapse:collapse">
					<tr>
						<th class="nui-form-label" nowrap="nowrap" style="width:5%;text-align: right;">流程编号：</th>
						<td nowrap="nowrap" style="width:20%;"><input id="processDefID" name="processDefID" class="nui-textbox asLabel" readonly="true" style="width:100%;"/> </td>
						<th class="nui-form-label" nowrap="nowrap" style="width:5%;text-align: right;">流程名称：</th>
						<td nowrap="nowrap" style="width:20%;"><input id="processChName" name="processChName" class="nui-textbox asLabel" readonly="true" style="width:100%;"/> </td>
						<th class="nui-form-label" nowrap="nowrap" style="width:5%;text-align: right;">当前状态：</th>
						<td nowrap="nowrap" style="width:20%;"><input id="currentState" name="currentState" class="nui-textbox asLabel" readonly="true" style="width:100%;"/> </td>
						<th class="nui-form-label" nowrap="nowrap" style="width:5%;text-align: right;">版本信息：</th>
						<td nowrap="nowrap" style="width:20%;"><input id="versionSign" name="versionSign" class="nui-textbox asLabel" readonly="true" style="width:100%;"/> </td>
					</tr>
					<tr>
						<th class="nui-form-label" nowrap="nowrap" style="text-align: right;">创建时间：</th>
						<td nowrap="nowrap"><input id="createTime" name="createTime" class="nui-datepicker asLabel" format="yyyy-MM-dd H:mm" readonly="true" style="width:100%;"/> </td>
						<th class="nui-form-label" nowrap="nowrap" style="text-align: right;">创建人：</th>
						<td nowrap="nowrap"><input id="processDefOwner" name="processDefOwner" class="nui-textbox asLabel" readonly="true" style="width:100%;"/> </td>
						<th class="nui-form-label" nowrap="nowrap" style="text-align: right;">更新时间：</th>
						<td nowrap="nowrap"><input id="updateTime" name="updateTime" class="nui-datepicker asLabel" format="yyyy-MM-dd H:mm" readonly="true" style="width:100%;"/> </td>
						<th class="nui-form-label" nowrap="nowrap" style="text-align: right;">执行：</th>
						<td nowrap="nowrap"><input id="operator" name="operator" class="nui-textbox asLabel" readonly="true" style="width:100%;"/> </td>
					</tr>
					<tr>
						<th class="nui-form-label" nowrap="nowrap" style="text-align: right;">定义名：</th>
						<td colspan=3 nowrap="nowrap"><input id="createTime" name="processDefName" class="nui-textbox asLabel" readonly="true" style="width:100%;"/> </td>
						<th class="nui-form-label" nowrap="nowrap" style="text-align: right;"></th>
						<td nowrap="nowrap"></td>
						<th class="nui-form-label" nowrap="nowrap" style="text-align: right;"></th>
						<td nowrap="nowrap"></td>
					</tr>
					<!-- <tr>
						<th class="nui-form-label" nowrap="nowrap" style="width:10%;text-align: right;">流程说明：</th>
						<td colspan=7 nowrap="nowrap" style="width:23%;"><input id="description" name="description" class="nui-textarea asLabel" readonly="true" style="width:100%;"/> </td>
					</tr>  -->
				</table>
			</div>
	 	</div>
		<div id="tabs1" class="nui-tabs" activeIndex="0" style="width:100%;height:83%;" plain="true">
	      <div name="processGraph" title="流程图" style="width:100%;height:100%;"></div> 
		  <div name="infoConfigNodeButton" title="节点按钮配置" style="width:100%;height:100%;"></div> 
		  <div name="roleConfigNodeButton" title="节点角色配置" style="width:100%;height:100%;"></div>		  
		</div> 
	</div>
	 <script type="text/javascript">
        nui.parse();
        var tabs = nui.get("tabs1");
        
        //获取form
		var form= new nui.Form("#processInfoForm");
		//获取参数-流程定义ID
		var processDefID = <%=processDefID%>;
		
		var pdstatus = "0";
		
		//显示流程定义-流程基本信息
		showDetail(processDefID);
		
		//判断当前流程定义状态，实现转换
		//pdstatus = nui.get("currentState").getValue();
		if(pdstatus == "1"){
			nui.get("currentState").setValue("停止");
			var processGraphtab= tabs.getTab("processGraph");
			tabs.loadTab("process_Info_processgraph.jsp?processDefID=<%=processDefID %>&pdstatus=stop", processGraphtab);
			
			var infoConfigNodeButtontab= tabs.getTab("infoConfigNodeButton");
			tabs.loadTab("process_Info_ConfigNodeButton.jsp?processDefID=<%=processDefID %>&pdstatus=stop", infoConfigNodeButtontab);
			
			var infoConfigNodeButtontab= tabs.getTab("roleConfigNodeButton");
			tabs.loadTab("process_Info_ConfigNodeRole.jsp?processDefID=<%=processDefID %>&pdstatus=stop", infoConfigNodeButtontab);
			
			//重载Tab，显示页面
			tabs.reloadTab(processGraphtab);
		}else if(pdstatus == "3"){
			nui.get("currentState").setValue("运行");
			var processGraphtab= tabs.getTab("processGraph");
			tabs.loadTab("process_Info_processgraph.jsp?processDefID=<%=processDefID %>", processGraphtab);
			
			var infoConfigNodeButtontab= tabs.getTab("infoConfigNodeButton");
			tabs.loadTab("process_Info_ConfigNodeButton.jsp?processDefID=<%=processDefID %>", infoConfigNodeButtontab);   
					
			var infoConfigNodeButtontab= tabs.getTab("roleConfigNodeButton");
			tabs.loadTab("process_Info_ConfigNodeRole.jsp?processDefID=<%=processDefID %>", infoConfigNodeButtontab);   
			
			//重载Tab，显示页面
			tabs.reloadTab(processGraphtab);
		}
		
		//展示页面明细的方法
     	function showDetail(processDefID){
            var json =nui.encode({processDefID:processDefID});
            $.ajax({
                url: "com.atozsoft.wf.processManager.queryProcessInfobyId.biz.ext",
                type: 'POST',
                data:json,
                cache: false,
                async: false,
                contentType: 'text/json',
                success: function(text) {
                    //var data=text.data;
                    var processInfo = nui.decode(text.data);
                    //将返回值显示到form中
                    form.setData(processInfo);
                    pdstatus = processInfo.currentState;
          		}
            });
        }
    </script>
</body>
</html>